{% extends "view.html" %}

{% set publication = context[scaffolding.singular] %}

{% block view_detail %}
    {% if publication.homepage %}
        <h4><a href="{{ publication.homepage }}" target="_blank">{{ publication.homepage_short() }}</a></h4>
    {% endif %}
{% endblock %}

{% block table_head %}
    <th>issue</th>
    <th>period</th>
    <th>cover</th>
    <th>link</th>
    <th></th>
{% endblock %}

{% block table_body %}

    {% for item in context['related'] %}
        <tr>
            <td><a href="{{ uri('issues:view', key=item.key.urlsafe()) }}">{{ item['number'] }}</a></td>
            <td>{{ item.period_year() }}</td>
            <td>{{ item['cover'] }}{% if item['cover_image_link'] %}<a href="{{ item['cover_image_link'] }}" target="_blank" title="link to cover image"><span class="btn-xs glyphicon glyphicon-new-window"></span></a>{% endif %}</td>
            <td>
            {% if item['link'] %}
                <a href="{{ item['link'] }}" target="_blank">{{ item.link_short() }}</a>
            {% endif %}
            </td>
            <td class="text-right">
                {{ buttons.view_edit_delete_buttons(item, controller='issues', target='issue') }}
            </td>
        </tr>
    {% endfor %}

{% endblock %}
